//
//  JiaoYiPageDetailViewController.m
//  DBAChain
//
//  Created by Mxionlly on 2018/9/17.
//  Copyright © 2018年 Evan. All rights reserved.
//  交易详情

#import "JiaoYiPageDetailViewController.h"
#import "JiaoYiPageDetailsView.h"
#import "JiaoYiPageDetailViewCell.h"
#import "JiaoYiPageDetailImageViewTableViewCell.h"
#import "JiaoYiShenSuViewController.h"
#import "AssetsTopView.h"
#import <Masonry.h>
#import "taskOverviewService.h"
#import "CommonData.h"
#import "GeneralTool.h"
#import "UIAlertController+Evan.h"

@interface JiaoYiPageDetailViewController ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>
@property (nonatomic,strong)UITableView    *tableView;
@property (nonatomic,strong)JiaoYiPageDetailsView *headView;
@property (nonatomic,strong)UIButton       *bottomButton;
@property (nonatomic,strong)UIButton       *bottomButton1;
@property (nonatomic,strong)NSArray        *cellArray;
@property (nonatomic,strong)UITextView     *textView;

@property (nonatomic,strong)NSString     *imgUrl;

@property (nonatomic,strong)    dataSaleOrderDetailInfo *modelDetail;

@end

@implementation JiaoYiPageDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    if (@available(iOS 11.0, *)) {
        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways;
    } else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    self.cellArray = @[@"",@"卖方信息",@"交易提醒"];
    [self tableView];
    
    [self loadData];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    if (self.navigationController.navigationBar.hidden == NO) {
        self.navigationController.navigationBar.hidden = YES;
    }
    [self setBlackStatus:YES];
    
    self.bottomButton.hidden = YES;
    if (self.isQiuGou) {
        [self.bottomButton1 setTitle:@"我已付款" forState:UIControlStateNormal];
        if (self.modelOrderDetailsInfo.orderType == 0) {
            [self.bottomButton1 setEnabled:YES];
        }else if(self.modelOrderDetailsInfo.orderType == 1){
            [self.bottomButton1 setEnabled:NO];
        }
    }else{///出售页
        if (self.modelOrderDetailsInfo.orderType == 0) {
            [self.bottomButton1 setTitle:@"等待对方付款" forState:UIControlStateNormal];
            self.bottomButton1.enabled = NO;
        }else if(self.modelOrderDetailsInfo.orderType == 1){
            [self.bottomButton setTitle:@"申诉" forState:UIControlStateNormal];
            [self.bottomButton setHidden:NO];
            [self.bottomButton1 setTitle:@"释放GTE" forState:UIControlStateNormal];
            self.bottomButton1.enabled = YES;
        }
    }
    if (self.modelOrderDetailsInfo.orderType == 2) {
        [self.bottomButton1 setEnabled:NO];
        [self.bottomButton1 setTitle:@"已完成" forState:UIControlStateNormal];
    }
    
}

#pragma mark - loadData

-(void)loadData{
    
    NSMutableDictionary *dict = [NSMutableDictionary new];
    //购买详情买家编号，出售详情卖家编号
//    NSString *strUserNo = [UserCenter shareCenter].user.userNo;
    if (!self.isQiuGou) {
        [dict setValue:self.modelOrderDetailsInfo.buyUserNo forKey:@"buyUserNo"];//买家用户编号
    }else{
        [dict setValue:self.modelOrderDetailsInfo.saleUserNo forKey:@"saleUserNo"];//卖家用户编号
    }
    [dict setValue:self.modelOrderDetailsInfo.orderNo forKey:@"orderNo"];
    [DKProgressHUD showLoading];
    [taskOverviewService getSaleOrderDetail:dict success:^(dataSaleOrderDetail *response, BOOL success) {
        [DKProgressHUD dismiss];
        if (success) {
            self.modelDetail = response.data;
            [self.tableView reloadData];
        }else{
            [DKProgressHUD showErrorWithStatus:response.statusDesc];
        }
    } failture:^(NSError *error, NSString *strDescription) {
        [DKProgressHUD dismiss];
        [DKProgressHUD showErrorWithStatus:strDescription];
    }];
}

#pragma mark - init
-(UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]init];
        [self.view addSubview:_tableView];
        [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.and.top.and.right.mas_equalTo(self.view);
            make.bottom.mas_equalTo(self.view.mas_bottom).offset(0);
        }];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor  = [UIColor clearColor];
        _tableView.scrollEnabled = YES;
        _tableView.estimatedSectionFooterHeight = 0;
        _tableView.estimatedSectionHeaderHeight = 0;
    }
    return _tableView;
}

-(JiaoYiPageDetailsView *)headView
{
    if (!_headView) {
        _headView = [[[NSBundle mainBundle] loadNibNamed:@"JiaoYiPageDetailsView" owner:nil options:nil] objectAtIndex:0];
        _headView.frame = CGRectMake(0, 0, KScreenWidth, 290);
        [_headView.btnBack addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _headView;
}

- (UITextView *)textView {
    if (!_textView) {
        _textView = [[UITextView alloc] initWithFrame:CGRectMake(15, 10, KScreenWidth - 30, 110)];
        _textView.font = [UIFont systemFontOfSize:13];
        _textView.textColor = UIColorFromRGB(0x666666);
        _textView.scrollEnabled = NO;
    }
    return _textView;
}

-(UIButton *)bottomButton
{
    if (!_bottomButton) {
        _bottomButton =[UIButton buttonWithType:UIButtonTypeCustom];
//        _bottomButton.frame =CGRectMake(15, 8, KScreenWidth/2 - 22.5, 44);
        _bottomButton.titleLabel.font = [UIFont systemFontOfSize:15];
        [_bottomButton setBackgroundImage:[UIImage imageNamed:@"icon_layercode_big"] forState:UIControlStateNormal];
        [_bottomButton setTitleColor:UIColorFromRGB(0xF05CA4) forState:UIControlStateNormal];
//        [_bottomButton setTitle:@"申诉" forState:UIControlStateNormal];
         [_bottomButton addTarget:self action:@selector(bottomButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _bottomButton;
}

-(UIButton *)bottomButton1
{
    if (!_bottomButton1) {
        _bottomButton1 =[UIButton buttonWithType:UIButtonTypeCustom];
//        _bottomButton1.frame =CGRectMake(KScreenWidth/2, 8, KScreenWidth/2 - 22.5, 44);
        _bottomButton1.titleLabel.font = [UIFont systemFontOfSize:15];
        [_bottomButton1 setBackgroundImage:[UIImage imageNamed:@"icon_register_forget"] forState:UIControlStateNormal];
        [_bottomButton1 setTitleColor:UIColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
//        [_bottomButton1 setTitle:@"释放DBA" forState:UIControlStateNormal];
        [_bottomButton1 addTarget:self action:@selector(bottomButton1Click:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _bottomButton1;
}

///左侧申述按钮
- (void)bottomButtonClick:(UIButton*)sender{
    ///跳转到申诉页面，提交申诉
    
    JiaoYiShenSuViewController *vc = [[JiaoYiShenSuViewController alloc]initWithNibName:@"JiaoYiShenSuViewController" bundle:nil];
    vc.orderNo = self.modelOrderDetailsInfo.orderNo;
    [self.navigationController pushViewController:vc animated:YES];
    
}


///释放--付款按钮---右侧按钮
- (void)bottomButton1Click:(UIButton*)sender{
    if (self.isQiuGou) {
        if (self.modelOrderDetailsInfo.orderType == 0) {
            //验证当恰您是否已上传转账图，然后进入付款接口验证
            if (![Check checkNullLenght:self.imgUrl]) {
                [DKProgressHUD showErrorWithStatus:@"请先上传打款信息"];
                return;
            }
            [self uploadUserImg:self.imgUrl];
        }else if(self.modelOrderDetailsInfo.orderType == 1){
            //当前是已付款页面，页面无交互按钮
        }
    }else{///出售页
        if (self.modelOrderDetailsInfo.orderType == 0) {
            //等待对方上传转账接口，并自己确认付款信息--页面无交互
            
        }else if(self.modelOrderDetailsInfo.orderType == 1){
            //对方付款完毕后，本地点击释放GTE，转账给对方
            [self confirmGTE];
        }
    }
}

///释放GTE
-(void)confirmGTE{
    
    NSMutableDictionary *dict = [NSMutableDictionary new];
    [dict setValue:self.modelDetail.tradeNo forKey:@"tradeNo"];
    [dict setValue:[UserCenter shareCenter].user.userNo forKey:@"saleUserNo"];
    [dict setValue:self.modelDetail.userNo forKey:@"buyUserNo"];
    
    [DKProgressHUD showLoading];
    [taskOverviewService getConfirmPayGte:dict success:^(dataCodeInfo *response, BOOL success) {
        [DKProgressHUD dismiss];
        if (success) {
            [DKProgressHUD showSuccessWithStatus:@"释放GTE成功"];
            [self.navigationController popViewControllerAnimated:YES];
        }else{
            [DKProgressHUD showErrorWithStatus:response.statusDesc];
        }
    } failture:^(NSError *error, NSString *strDescription) {
        [DKProgressHUD dismiss];
        [DKProgressHUD showErrorWithStatus:strDescription];
    }];
}


#pragma mark - UITableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.cellArray.count;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return section;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if (section == 0) return 0.00001;
    if (section == 2) return 60;
    return 10;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    if (section == 2) {
        UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 60)];
        footerView.backgroundColor = [UIColor whiteColor];
        
        self.bottomButton.hidden = YES;
        [footerView addSubview:self.bottomButton];

        [footerView addSubview:self.bottomButton1];
        if (!self.isQiuGou && self.modelOrderDetailsInfo.orderType == 1) {
            self.bottomButton.hidden = NO;
            CGFloat diffWidth = KScreenWidth/2-40;
            ///出售页
            [self.bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(footerView.mas_left).offset(30);
                make.top.mas_equalTo(footerView.mas_top).offset(0);
                make.height.offset(40);
                make.width.offset(diffWidth);
            }];
            [self.bottomButton1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.mas_equalTo(footerView.mas_right).offset(-30);
                make.top.mas_equalTo(footerView.mas_top).offset(0);
                make.height.offset(40);
                make.width.offset(diffWidth);
            }];
        }else{
            [self.bottomButton1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(footerView.mas_left).offset(30);
                make.right.mas_equalTo(footerView.mas_right).offset(-30);
                make.top.mas_equalTo(footerView.mas_top).offset(0);
                make.height.offset(50);
            }];
        }
        return footerView;
    }
    return nil;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) return 290;
    return 50;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    if (section == 0){
        NSString *str = self.isQiuGou ? @"购买":@"出售";
        self.headView.labelTitle.text = [NSString stringWithFormat:@"向%@%@GTE",self.modelDetail.userName,str];
        self.headView.labelAmountCNY.text = self.modelOrderDetailsInfo.orderAmount;
        self.headView.labelPrice.text = [NSString stringWithFormat:@"价格：%@CNY",self.modelOrderDetailsInfo.prince];
        self.headView.labelNumber.text = [NSString stringWithFormat:@"数量：%@GTE",self.modelOrderDetailsInfo.count];
        self.headView.labelOrderNo.text = [NSString stringWithFormat:@"订单号：%@",self.modelOrderDetailsInfo.orderNo];
        self.headView.labelStatus.text = self.modelDetail.verifiedStatus;
        return self.headView;
    }
    
    AssetsTopView *headView = [[[NSBundle mainBundle] loadNibNamed:@"AssetsTopView" owner:nil options:nil] objectAtIndex:0];
    headView.frame = CGRectMake(0, 0, KScreenWidth, 50);
    headView.backgroundColor = [UIColor whiteColor];
    headView.lbtitle.text = self.isQiuGou ? @"卖方信息":@"买方信息"; //self.cellArray[section];
    return headView;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 1) return 200;
    return indexPath.row == 0 ? 120 : 230;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 1) {
        JiaoYiPageDetailViewCell *cell = [JiaoYiPageDetailViewCell cellWithTableView:tableView index:0];
        [cell.imgHead sd_setImageWithURL:[NSURL URLWithString:self.modelDetail.imageUrl] placeholderImage:[UIImage imageNamed:@"icon_avatar"]];
        cell.labelName.text = [NSString stringWithFormat:@"真实姓名：%@",self.modelDetail.userName];
        cell.labelPhone.text = [NSString stringWithFormat:@"电话号码：%@",self.modelDetail.phone];
        cell.labelUserNo.text = [NSString stringWithFormat:@"会员编号：%@",self.modelDetail.userNo];
        cell.labelAlipay.text = [NSString stringWithFormat:@"%@ %@",self.modelDetail.userName,self.modelDetail.alipay];
        cell.labelCardName.text = self.modelDetail.bankName;
        cell.labelCardNumber.text = [NSString stringWithFormat:@"%@ %@",self.modelDetail.userName,self.modelDetail.cardNo];
        [cell.phoneButton addTarget:self action:@selector(callPhone) forControlEvents:UIControlEventTouchUpInside];
        return cell;
    }else{
        if (indexPath.row == 0) {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
            }
            self.textView.text=@"1.您的汇款将直接进入卖方账户，交易过程中卖方出售的数字资产由平台托管保护。\n2.请在规定时间内完成付款，并务必点击“我已付款”，卖方确认收款后，系统会将数字资产划转到您的账户。\n3.买方当日累计3笔取消，将限制当天的买入功能。";
            [cell.contentView addSubview:self.textView];
            return cell;
        }else{
            JiaoYiPageDetailImageViewTableViewCell *cell = [JiaoYiPageDetailImageViewTableViewCell cellWithTableView:tableView IndexPath:indexPath];
            
            [cell.imgRight sd_setImageWithURL:[NSURL URLWithString:self.modelDetail.imageUrl] placeholderImage:[UIImage imageNamed:@"screenshot"]];
            
            [cell.btnImage addTarget:self action:@selector(btnUploadImgClick:) forControlEvents:UIControlEventTouchUpInside];
            NSData *dataImg= [NSData dataWithContentsOfURL:[NSURL URLWithString:self.modelDetail.imageUrl]];
            UIImage *image = [UIImage imageWithData:dataImg];
            [cell.btnImage setBackgroundImage:image forState:UIControlStateNormal];
            
            if (self.isQiuGou) {
                cell.labelTitle.text = @"上传一张付款截图";
                cell.labelDes.text = @"请务必保证截图真实性";
            }else{
                cell.labelTitle.text = @"对方已上传付款截图";
                cell.labelDes.text = @"请确认收款金额";
            }
            
            return cell;
        }
    }
    return nil;
}

-(void)callPhone
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[[NSMutableString alloc] initWithFormat:@"telprompt://%@",self.modelDetail.phone]]];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 上传图片

- (void)btnUploadImgClick:(UIButton*)sender{
    NSLog(@"点击上传转款证明图片");
    [GeneralTool showActionSheetWithTitle:@"" firstActionTitle:@"拍照" secondActionTitle:@"从手机相册选择" cancelActionTitle:@"取消" controller:self actionBlock:^(id aResponseObject, NSError *anError) {
        [self chooseImagePicker:[aResponseObject integerValue]];
    }];
    
}


#pragma mark - 相片选择
-(void)chooseImagePicker:(NSInteger )index{
    
    NSUInteger sourceType = 0;
    // 判断系统是否支持相机
    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        imagePickerController.delegate = self; //设置代理
        imagePickerController.allowsEditing = YES;
        imagePickerController.sourceType = sourceType; //图片来源
        if (index == 0) {
            return;
        }else if (index == 1) {
            //拍照
            sourceType = UIImagePickerControllerSourceTypeCamera;
            imagePickerController.sourceType = sourceType;
            [self presentViewController:imagePickerController animated:YES completion:nil];
        }else if (index == 2){
            //相册
            sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            imagePickerController.sourceType = sourceType;
            [self presentViewController:imagePickerController animated:YES completion:nil];
        }
    }else {
        sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        imagePickerController.sourceType = sourceType;
        [self presentViewController:imagePickerController animated:YES completion:nil];
    }
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
    
    [self fileUpload:image];
    if (@available(iOS 11.0, *)){
        [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
    }
    //处理完毕，回到个人信息页面
    [self dismissViewControllerAnimated:YES completion:nil];
    [picker dismissViewControllerAnimated:YES completion:NULL];
}


- (void)fileUpload:(UIImage*)filePath {
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.requestSerializer.timeoutInterval = 20;
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithArray:@[@"text/plain",@"multipart/form-data"]];
    
    
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"application/json"];
    [manager.requestSerializer setValue:[UserCenter shareCenter].authToken forHTTPHeaderField:@"token"];
    [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [manager.requestSerializer setValue:@"iOS" forHTTPHeaderField:@"source"];
    [manager.requestSerializer setValue:@"APP" forHTTPHeaderField:@"User-Agent"];
    NSString *url = [NSString stringWithFormat:@"%@%@", YBaseURLString,DEF_API_uploadImg];
    NSMutableDictionary *dict = [NSMutableDictionary new];
//    [dict setObject:filePath forKey:@"file"];
    [dict setValue:[UserCenter shareCenter].authToken forKey:@"token"];
    NSLog(@"上传图片入参：%@%@",DEF_API_uploadImg,dict);
    [manager POST:url parameters:dict constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
        NSDate *date = [NSDate date];
        NSDateFormatter *formormat = [[NSDateFormatter alloc]init];
        [formormat setDateFormat:@"HHmmss"];
        NSString *dateString = [formormat stringFromDate:date];
        
        NSString *fileName = [NSString  stringWithFormat:@"%@.png",dateString];
        NSData *imageData = UIImageJPEGRepresentation(filePath, 1);
        double scaleNum = (double)300*1024/imageData.length;
        if(scaleNum <1){
            imageData = UIImageJPEGRepresentation(filePath, scaleNum);
        }else{
            imageData = UIImageJPEGRepresentation(filePath, 0.1);
        }
        [formData  appendPartWithFileData:imageData name:@"file" fileName:fileName mimeType:@"image/jpg/png/jpeg"];
        [DKProgressHUD showLoadingWithStatus:@"正在上传..."];
    } progress:^(NSProgress * _Nonnull uploadProgress) {
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        [DKProgressHUD dismiss];
        NSDictionary *datas = responseObject;
        NSString *statusCode = [datas objectForKey:@"statusCode"];
        if (statusCode) {
            NSString *strError = [datas objectForKey:@"statusDesc"];
            [[UIAlertController alloc] alertTitle:@"上传失败" alertMessage:strError leftCancelTitle:nil leftCancel:nil rightTitle:@"确定" rightOK:^(UIAlertAction *action) {
                
            }];
            return ;
        }
        
        NSString *strUrl = [datas objectForKey:@"data"];
        self.imgUrl = strUrl;
        
        JiaoYiPageDetailImageViewTableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:2]];
        NSData *dataImg= [NSData dataWithContentsOfURL:[NSURL URLWithString:strUrl]];
        UIImage *image = [UIImage imageWithData:dataImg];
        [cell.btnImage setBackgroundImage:image forState:UIControlStateNormal];
        
//        [self uploadUserImg:strUrl];
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        [DKProgressHUD showErrorWithStatus:@"头像修改失败"];
    }];
}

-(void)uploadUserImg:(NSString*)url{
    NSMutableDictionary *dict = [NSMutableDictionary new];
    
    [dict setValue:self.modelDetail.tradeNo forKey:@"tradeNo"];
    [dict setValue:url forKey:@"imageUrl"];
    
    [DKProgressHUD showLoading];
    [taskOverviewService getPayMoney:dict success:^(dataCodeInfo *response, BOOL success) {
        [DKProgressHUD dismiss];
        if (success) {
            JiaoYiPageDetailImageViewTableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:2]];
            NSData *dataImg= [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
            UIImage *image = [UIImage imageWithData:dataImg];
            [cell.btnImage setBackgroundImage:image forState:UIControlStateNormal];
            
//            [self.bottomButton setTitle:@"取消订单" forState:UIControlStateNormal];
            [self.bottomButton1 setTitle:@"我已付款" forState:UIControlStateNormal];
            [self.bottomButton1 setEnabled:NO];
            
            [self loadData];
        }else{
            [DKProgressHUD showErrorWithStatus:response.statusDesc];
        }
    } failture:^(NSError *error, NSString *strDescription) {
        [DKProgressHUD dismiss];
        [DKProgressHUD showErrorWithStatus:strDescription];
    }];
    
}


@end
